<?php
/*
 * IKPHP 爱客开源社区 @copyright (c) 2012-3000 IKPHP All Rights Reserved 
 * @author 小麦
 * @Email:810578553@qq.com
 */
namespace Home\Controller;
use Common\Controller\FrontendController;
use Common\Util\Upload;
class IndexController extends FrontendController {
    /**
     * 网站初始化
     * @author 小麦 <810578553@vip.qq.com>
     */	
	public function _initialize() {
		parent::_initialize ();
		
		$this->user_mod = D ( 'Common/User' );
		//$this->group_topic_mod = D ( 'group/group_topics' );
		
		//$this->article_mod = D('article/article');
		//$this->article_channel_mod = D('article/article_channel');
		//$this->note_mod = D('space/note');
		//$this->photo_album_mod = D('space/user_photo_album');
		
		//小组模型
		$this->group_mod = D ( 'Group/Group' );
	}	
    /**
     * 网站首页
     * @author 小麦 <810578553@vip.qq.com>
     */	
    public function index(){
		//活跃会员
		$arrHotUser = $this->user_mod->getHotUser(14);
		$this->assign ( 'arrHotUser', $arrHotUser );
		
		//推荐小组10个
		$arrRecommendGroups = $this->group_mod->getRecommendGroup ( 14 );
		foreach ( $arrRecommendGroups as $key => $item ) {
			$arrRecommendGroup [] = $item;
			$arrRecommendGroup [$key] ['groupdesc'] = getsubstrutf8 ( clearText ( $item ['groupdesc'] ), 0, 35 );
		}
		$this->assign ( 'arrRecommendGroup', $arrRecommendGroup );	
		
		$this->_config_seo ();    	
		$this->display();
    }
	public function style(){

		$ikTheme = cookie('ikTheme');
		$ikTheme = empty($ikTheme) ? 'blue' : $ikTheme;
		$arrTheme	= ikScanDir('Public/Theme');
		$this->assign('arrTheme',$arrTheme);
		$this->assign('ikTheme',$ikTheme);
		$this->_config_seo ( array (
				'title' => '更换主题风格',
				'keywords' =>'',
				'description'=>'',
		) );
		$this->display();
	}  

	public function up(){
		header("Content-type: text/html; charset=utf-8");
		$u = new Upload();
		echo $u->savelocalfile();
	}
    
}